import time


f3 = open(".\\test_file\\test3.txt", "a", encoding= "gb18030")

f3.write("一二三四五；\n上山打老虎；\n老虎没打到；\n打到小松鼠。\n")

f3.flush() # 刷新，将内存中积攒的内容写入硬盘
time.sleep(5)

f3.close() # 内置了flush